package insight.google.game.era.data;

public class AppDataManagerFactory {
	
	
	public enum DataManager {

		USER_DATA_MANAGER,
		GAMEUSER_DATA_MANAGER,
		ROOM_DATA_MANAGER,
		GAMECENTER_DATA_MANAGER;
		
//		String value;
//		private DataManager(String value){
//			this.value = value;
//		}
//		public String toString(){
//			return value;
//		}
	}
	
	private static AppDataManagerFactory instance;
	
	private AppDataManagerFactory(){
		
	}
	
	public static AppDataManagerFactory getInstance(){
		if(instance == null){
			instance = new AppDataManagerFactory();
		}
		return instance;
	}
	
	
	public AppDataManager getDataManager(String dataManagerId,TransactionHandler txHandler){
		switch (DataManager.valueOf(dataManagerId)) {
		case USER_DATA_MANAGER:
			return new UserDataManager(txHandler);
		case GAMEUSER_DATA_MANAGER:
			return new GameUserDataManager(txHandler);	
		case ROOM_DATA_MANAGER:
			return new RoomDataManager(txHandler);
		case GAMECENTER_DATA_MANAGER:
			return new GameCenterDataManager(txHandler);
		default:
			break;
		}
		return null;
	}
	
}
